﻿using MediatR;
using RBAC.LuFang.API.Application.Command.RoleCommand;
using RBAC.LuFang.Domain.DTO;
using RBAC.LuFang.Domin.Services;

namespace RBAC.LuFang.API.Application.CommandHandlers.RoleHandler
{
    //反填部门树形
    public class DepartmentFanCommandHandler:IRequestHandler<DepartmentFanCommand, List<GetRoleDTO>>
    {
        private readonly IRoleService _roleService;

        public DepartmentFanCommandHandler(IRoleService roleService)
        {
            _roleService = roleService;
        }

        public async Task<List<GetRoleDTO>> Handle(DepartmentFanCommand request, CancellationToken cancellationToken)
        {
            return await _roleService.GetRole(request.roleId);
        }
    }
}
